import { messageInfo, pageParams } from "./type";
import service from "@/utils/request";
import { AxiosPromise } from "axios";

const { messageService } = service;

/**
 *
 * @param data 管理员获取数据
 * @returns
 */
export function getMessage(data: pageParams): AxiosPromise<any> {
  return messageService({
    url: "/message/getSystemMessage",
    method: "get",
    params: data,
  });
}

/**
 *
 * @param data 管理员发布告示
 * @returns
 */
export function publishNotice(data: messageInfo): AxiosPromise<any> {
  return messageService({
    url: "/message/messagePush",
    method: "post",
    data: data,
  });
}

/**
 *
 * @param ids 管理员删除告示
 * @returns
 */
export function deleteNotice(ids: number): AxiosPromise<any> {
  return messageService({
    url: "/message/deleteSystemMessage/" + ids,
    method: "delete",
  });
}

/**
 *
 * @param data 管理员更新告示
 * @returns
 */
export function updateNotice(data: messageInfo): AxiosPromise<any> {
  return messageService({
    url: "/message/updateSystemMessage",
    method: "put",
    data: data,
  });
}
